home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 187_01 / tseconds.c < prev    next >
Text File  |  1986-01-26  |  1KB  |  42 lines

  1. /*@*******************************************************/
  2. /*@                                                      */
  3. /*@ tseconds - return the current time-of-day in         */
  4. /*@        tenths of seconds since midnight.             */
  5. /*@                                                      */
  6. /*@   Usage:     tseconds();                             */
  7. /*@                                                      */
  8. /*@   Returns a long value representing the number       */
  9. /*@      of seconds since midnight (0 <= x <= 864,000)   */
  10. /*@                                                      */
  11. /*@*******************************************************/
  12.  
  13. unsigned hour, min, sec, hund;
  14.  
  15. long tseconds()
  16. {
  17.     
  18. #asm
  19.     PUSH    AX
  20.     PUSH    CX
  21.     PUSH    DX
  22.     MOV        AX,2C00H
  23.     INT        21H
  24.     MOV        AH,00
  25.     MOV        AL,CH
  26.     MOV        WORD hour_,AX
  27.     MOV        AL,CL
  28.     MOV        WORD min_,AX
  29.     MOV        AL,DH
  30.     MOV        WORD sec_,AX
  31.     MOV        AL,DL
  32.     MOV        WORD hund_,AX
  33.     POP        DX
  34.     POP        CX
  35.     POP        AX
  36. #endasm
  37.  
  38.     return ((long)hour * 36000 + (long)min * 600
  39.              + (long)sec * 10 + (long)hund / 10);
  40.  
  41. }
  42.